/*
 * Copyright 2009-2009 Tiago da Fonseca Frazao  All rights reserved.
 */

package mz.co.research.shared.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @author Tiago da Fonseca Frazao
 */
@Entity
@Table(name = "USER")
public class User extends UpdatableEntity {

	@Column(name = "USERNAME", length = 45, nullable = false)
	private String username;

	@Column(name = "PASSWORD", length = 45, nullable = false)
	private String password;

	@Column(name = "FIRST_NAME", length = 20, nullable = false)
	private String firstName;

	@Column(name = "LAST_NAME", length = 20, nullable = false)
	private String lastName;

	@Column(name = "EMAIL", length = 45, nullable = false)
	private String email;

	@Column(name = "ADDRESS", length = 100, nullable = false)
	private String address;

	@Column(name = "HOME_PHONE", length = 10, nullable = false)
	private String phoneHome;

	@Column(name = "MOBILE_PHONE", length = 10, nullable = false)
	private String phoneMobile;

	@Column(name = "GENDER", length = 1, nullable = false)
	private String gender;

	@Column(name = "MAIL_LIST", nullable = false)
	private Boolean mailList;

	@Column(name = "TOKEN", length = 15, nullable = false)
	private String token;

	@Transient
	private Boolean resetPassword;

	@Column(name = "ROLE_ID", nullable = false)
	private Long roleId;

	public User() {
	}

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username
	 *            the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the first name
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * @param name
	 *            the first name to set
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @return the lastName
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * @param lastName
	 *            the lastName to set
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email
	 *            the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return the address
	 */
	public String getAddress() {
		return address;
	}

	/**
	 * @param address
	 *            the address to set
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * @return the phoneHome
	 */
	public String getPhoneHome() {
		return phoneHome;
	}

	/**
	 * @param phoneHome
	 *            the phoneHome to set
	 */
	public void setPhoneHome(String phoneHome) {
		this.phoneHome = phoneHome;
	}

	/**
	 * @return the phoneMobile
	 */
	public String getPhoneMobile() {
		return phoneMobile;
	}

	/**
	 * @return the gender
	 */
	public String getGender() {
		return gender;
	}

	/**
	 * @param gender
	 *            the gender to set
	 */
	public void setGender(String gender) {
		this.gender = gender;
	}

	/**
	 * @param phoneMobile
	 *            the phoneMobile to set
	 */
	public void setPhoneMobile(String phoneMobile) {
		this.phoneMobile = phoneMobile;
	}

	/**
	 * @return the token
	 */
	public String getToken() {
		return token;
	}

	/**
	 * @param token
	 *            the token to set
	 */
	public void setToken(String token) {
		this.token = token;
	}

	/**
	 * @return the mailList
	 */
	public Boolean getMailList() {
		return mailList;
	}

	/**
	 * @param mailList
	 *            the mailList to set
	 */
	public void setMailList(Boolean mailList) {
		this.mailList = mailList;
	}

	/**
	 * @return the resetPassword
	 */
	public Boolean getResetPassword() {
		return resetPassword;
	}

	/**
	 * @param resetPassword
	 *            the resetPassword to set
	 */
	public void setResetPassword(Boolean resetPassword) {
		this.resetPassword = resetPassword;
	}

	/**
	 * @return the roleId
	 */
	public Long getRoleId() {
		return roleId;
	}

	/**
	 * @param roleId
	 *            the roleId to set
	 */
	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	@Override
	public String toString() {
		StringBuilder buffer = new StringBuilder("\nUser");

		buffer.append(super.toString());

		buffer.append("\nusername  :" + this.username);
		buffer.append("\nemail     :" + this.email);
		buffer.append("\nfirstName :" + this.firstName);
		buffer.append("\nlastName  :" + this.lastName);
		buffer.append("\ntoken     :" + this.token);

		return buffer.toString();

	}
}
